package com.taldh.jvm.gc;

import java.util.LinkedList;

public class YgcTest {

    public static final LinkedList<String> strings = new LinkedList<>();

    /**
     * -Xmx256m -XX:+UseG1GC
     * -XX:+UnlockExperimentalVMOptions -XX:G1LogLevel=finest
     * -XX:+PrintGCDateStamps
     */
    // -XX:G1LogLevel=finest 是一个实验参数，需要打开-XX:+UnlockExperimentalVMOptions
    // -XX:+PrintGCDateStamps 打印的是日期，2020-09-07T20:58:21.758+0800
    // -XX:+PrintGCTimeStamps，打印的是时间戳, 10.090
    public static void main(String[] args) throws InterruptedException {
        int iteration = 0;
        while (true) {
            for (int i = 0; i < 100; i++) {
                for (int j = 0; j < 10; j++) {
                    strings.add(new String("String " + j));
                }
            }
            Thread.sleep(100);
        }

    }

}
